<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        fetch('http://www.localhost:3000/books', {
                method: 'post',
                body: 'uname=jerry&pwd=123',
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                },
            })
            .then((data) => {
                return data.text();
            })
            .then((data) => {
                console.log(data);
            });
        fetch('http://www.localhost:3000/books/123', {
                method: 'put',
                // body: 'uname=tom&pwd=789',
                body: JSON.stringify({
                    uname: 'tom',
                    pwd: 000,
                }),
                headers: {
                    'Content-Type': 'application/json',
                },
            })
            .then((data) => {
                return data.text();
            })
            .then((data) => {
                console.log(data);
            });
    </script>
</body>

</html>